﻿Imports Mysoft.Map.Data

Partial Public Class SelectSubMedia
    Inherits Mysoft.Map.Application.Security.AppPage

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            data_Bind()
        End If
    End Sub

    '绑定数据
    Private Sub data_Bind()
        Dim strSql As String

        strSql = String.Format("SELECT '0' AS code, '媒体类别' AS name,'0' as allowselect " & _
                            " UNION " & _
                            " SELECT '0.'+ MainMediaCode AS code, MainMediaName as name,'0' as allowselect FROM dbo.s_MainMedia " & _
                            " UNION " & _
                            " SELECT '0.'+ SubMediaCode AS code, SubMediaName as name,'1' as allowselect " & _
                            " FROM dbo.s_SubMedia sm inner join s_MainMedia mm on sm.MainMediaGUID = mm.MainMediaGUID" & _
                            " WHERE BUGUID = '{0}' " & _
                            " ORDER BY code", Session("BUGUID"))
        repSubMedia.BindMode = 0
        repSubMedia.PKField = "code"
        repSubMedia.ConnectionString = MyDB.GetSqlConnectionString    '设置连接字符串
        repSubMedia.SQL = strSql         '设置查询语句
        repSubMedia.DataBind()           '绑定数据
    End Sub
End Class